/**
 * 
 */
package com.thor.palmmall.rest.chart.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.rest.chart.AMaintainRepairData;
import com.thor.palmmall.spi.chart.SMaintainRepairData;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class AMaintainRepairDataConverter
    implements Converter<SMaintainRepairData, AMaintainRepairData> {

  public static AMaintainRepairDataConverter getInstance() {
    if (instance == null)
      instance = new AMaintainRepairDataConverter();
    return instance;
  }

  private static AMaintainRepairDataConverter instance;

  private AMaintainRepairDataConverter() {
  }

  @Override
  public AMaintainRepairData convert(SMaintainRepairData source) {
    if (source == null) {
      return null;
    }
    AMaintainRepairData target = new AMaintainRepairData();
    target.setInnerQty(source.getInnerQty());
    target.setOverTimeQty(source.getOverTimeQty());
    target.setQty(source.getQty());
    target.setRepairPerson(UCN.newInstance(source.getRepairPerson()));
    target.setRepairTime(source.getRepairTime());
    target.setTenantQty(source.getTenantQty());
    return target;
  }

}
